local blaze = require "blaze"
local game = require "club.threecard.sudoku"

local SimpleList = require "blaze.ui.widget.SimpleList"
local PuzzleState = require "club.threecard.sudoku.ui.common.PuzzleState"

local M = blaze.class(SimpleList)

function M:ctor()
    self.current = 0
    self.max = 0
end

function M:create_item(data, index)
    return PuzzleState.new(data, index)
end

function M:set_value(current, max)
    if current == self.current and max == self.max then
        return
    end

    local data = {}
    for i = 1, max do
        table.insert(data, i <= current)
    end
    self:fill(data)
end

return M